class ProjectsController < ApplicationController

def index

		@projects = Project.all
		@program = Program.find(3)

	end

	def show
		@projects = Project.all
		@project= Project.find(params[:id])
		@allTestimonials = Testimonial.all

	end

	def new
		@project = Project.new
	end

	def create
			@project = Project.new(params[:project])
		

		if @project.save

		redirect_to projects_path, :notice => "Your Post was saved"

		else

			render "new"

		end

	end

	def edit

		@project = Project.find(params[:id])

	end

	def update
		@project = Project.find(params[:id])

		if @project.update_attributes(params[:project])
			redirect_to :action => "show", :id => params[:id]

		else

			render "edit"

		end
	end

	def destroy

		@project = Project.find(params[:id])
		 @project.destroy
			redirect_to projects_path , :notice => "Your Post was deleted"
			
	end


end
